-- GENERATED SPELL FOR [Necro Knight] --


function spell0_16165(pUnit, Event) --@Arcane Explosion,Self--
pUnit:FullCastSpellOnTarget(15453,pUnit)
pUnit:RegisterEvent('Sorts_16165', 1500, 1)
end

function spell1_16165(pUnit, Event) --@Blast Wave,Self--
pUnit:FullCastSpellOnTarget(30092,pUnit)
pUnit:RegisterEvent('Sorts_16165', 8329, 1)
end

function spell2_16165(pUnit, Event) --@Blink,Self--
pUnit:FullCastSpellOnTarget(28391,pUnit)
pUnit:RegisterEvent('Sorts_16165', 1286, 1)
end

function spell3_16165(pUnit, Event) --@Cone of Cold,Self--
pUnit:FullCastSpellOnTarget(30095,pUnit)
pUnit:RegisterEvent('Sorts_16165', 8292, 1)
end

function spell4_16165(pUnit, Event) --@Flamestrike,n/a--
pUnit:FullCastSpellOnTarget(30091,pUnit:GetMainTank ())
pUnit:RegisterEvent('Sorts_16165', 10000, 1)
end

function spell5_16165(pUnit, Event) --@Frost Nova,Self--
pUnit:FullCastSpellOnTarget(30094,pUnit)
pUnit:RegisterEvent('Sorts_16165', 8264, 1)
end

function Sorts_16165(pUnit, Event)
local choix_sorts_16165 = math.random(0, 5)
if choix_sorts_16165 == 0 then
pUnit:RegisterEvent('spell0_16165', 1, 1)
end
if choix_sorts_16165 == 1 then
pUnit:RegisterEvent('spell1_16165', 1, 1)
end
if choix_sorts_16165 == 2 then
pUnit:RegisterEvent('spell2_16165', 1, 1)
end
if choix_sorts_16165 == 3 then
pUnit:RegisterEvent('spell3_16165', 1, 1)
end
if choix_sorts_16165 == 4 then
pUnit:RegisterEvent('spell4_16165', 1, 1)
end
if choix_sorts_16165 == 5 then
pUnit:RegisterEvent('spell5_16165', 1, 1)
end
end

function mob16165_Action(pUnit, Event)
pUnit:RegisterEvent('Sorts_16165', math.random(1500, 3000), 1)
end

function mob16165_Leave(pUnit, Event)
--pUnit:RemoveEvents();--
end

function mob16165_Kill(pUnit, Event)
--pUnit:RemoveEvents();--
end

function mob16165_Die(pUnit, Event)
pUnit:RemoveEvents();
end

RegisterUnitEvent(16165, 1, 'mob16165_Action')
RegisterUnitEvent(16165, 2, 'mob16165_Leave')
RegisterUnitEvent(16165, 3, 'mob16165_Kill')
RegisterUnitEvent(16165, 4, 'mob16165_Die')
